(function(doc, win) {
  var docEle = doc.documentElement,
      recalc = function() {
        var clientWidth = docEle.clientWidth
        if(!clientWidth)
          return
        docEle.style.fontSize = 20 * (clientWidth / 320) + 'px'
      }
  win.addEventListener('resize', recalc)
  doc.addEventListener('DOMContentLoaded', recalc)
})(document, window);